{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2023-12-04T03:21:04.855465900Z",
     "start_time": "2023-12-04T03:21:04.812694Z"
    }
   },
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import re\n",
    "\n",
    "df = pd.read_csv('../static/data/scenic_spots_info.csv')\n",
    "df['address'] = df['address'].apply(lambda x:x.replace('\\r\\n','').replace(' ',''))\n",
    "df['star_level'] = df['star_level'].apply(lambda x:re.findall('[0-9]{2}',x)[0])\n",
    "df['star_level'] = df['star_level'].apply(lambda x:int(x)/20)\n",
    "df['number_of_comments'] = df['number_of_comments'].apply(lambda x:x.replace('\\r\\n','').replace(' ','')[1:-4]).astype(int)\n",
    "df['comment'] = df['comment'].apply(lambda x:x.replace('\\r\\n','').replace(' ',''))\n",
    "df.to_csv('../static/data/scenic_spots_info_clean.csv',index=False)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
